<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://java.sun.com/jsp/jstl/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:cvis="http://mse10.ru.org/cvis"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<ui:composition template="/template.xhtml">
	<ui:define name="head">
		<link
			href="#{facesContext.externalContext.requestContextPath}/css/rf/calendar.css"
			rel="stylesheet" type="text/css" />
	</ui:define>
	<ui:define name="content">
		<div id="head" align="center">
			<h:outputText value="#{label.searchCV}" style="font-size: 30px;" />
			<hr></hr>
		</div>
		<div id="page">
			<h:outputStylesheet>
        .col1 { vertical-align:top; }
        .col2 { vertical-align:top; width:450px; }
        .wizard { width:958px; }
        .wform td { vertical-align:top; }
        .wfcol1 { text-align: right; white-space:nowrap; }
        .wfcol2 { }
        .wfcol3 { }
        .s1row td { height:30px;}
        .rich-message { color:red; }
 
        .navPanel {
        position:relative;
        bottom:0;
        height:23px;
        margin:0;
        padding:2px;
        }
    </h:outputStylesheet>
			<br />
			<h:panelGrid columns="12" columnClasses="col1,col2">
				<rich:panel styleClass="wizard">
					<f:facet name="header">
						<h:outputText value="#{label.cvSearchInfo}" />
					</f:facet>
					<a4j:jsFunction name="previewCV" action="#{searchCV.previewSearchResult()}">
				<a4j:param name="id" assignTo="#{searchCV.selectedId}" /> 
			</a4j:jsFunction>
					<h:form id="searchForm" enctype="multipart/form-data">
						<rich:togglePanel switchType="ajax">
							<rich:togglePanelItem>
								<ui:include src="/pages/fragments/searchCVSteps/step1.xhtml" />
							</rich:togglePanelItem>
							<rich:togglePanelItem>
								<ui:include src="/pages/fragments/searchCVSteps/step2.xhtml" />
							</rich:togglePanelItem>
							<rich:togglePanelItem>
								<ui:include src="/pages/fragments/searchCVSteps/step3.xhtml" />
							</rich:togglePanelItem>
							<rich:togglePanelItem>
								<ui:include src="/pages/fragments/searchCVSteps/finalstep.xhtml" />
							</rich:togglePanelItem>
						</rich:togglePanel>
						<div style="margin: 0px auto 0px auto; text-align: center;">
							<h:commandButton action="#{searchCV.actionSearch(cvDto)}"
								value="#{label.search}" />
							<h:commandButton value="Save Search"
								rendered="#{searchCV.showSaveSearch}">
								<rich:componentControl target="saveSearchPop" operation="show" />
							</h:commandButton>
						</div>
						<div
							style="border: 5px solid gray; background-color: #D6E6FB; font-weight: bold; color: #0B356C; font-size: 12px;">
							<rich:dataTable id="cvSearchTable" value="#{searchCV.dataModel}"
								var="cv_data">
								<f:facet name="header">
									<rich:columnGroup>
										<rich:column colspan="12">
											<h:outputText value="#{label.cvResults}" />
										</rich:column>
										<rich:column breakRowBefore="true">
											<h:outputText value="#{label.cvJobTitle}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvCountry}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvCity}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvDateOfBirth}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvNationality}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvRole}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvExpirience}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvSkill}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvLanguage}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvInstitution}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvDegree}" />
										</rich:column>
										<rich:column>
											<h:outputText value="#{label.cvQualification}" />
										</rich:column>
									</rich:columnGroup>
								</f:facet>
								<rich:column colspan="12">
									<rich:collapsibleSubTableToggler for="sbtbl" />
									<h:outputText value="#{cv_data.personalInformation.title}" />
								</rich:column>
								<rich:collapsibleSubTable value="#{cv_data}" var="cv_data" rowClass="trhover"
									id="sbtbl" expandMode="client" style="font-size: 12px;" onrowclick="previewCV(#{cv_data.id})">
									<rich:column>
										<h:outputText value="#{cv_data.personalInformation.title}" />
									</rich:column>
									<rich:column>
										<h:outputText value="#{cv_data.address.country}" />
									</rich:column>
									<rich:column>
										<h:outputText value="#{cv_data.address.city}" />
									</rich:column>
									<rich:column>
										<h:outputText
											value="#{cv_data.personalInformation.dateOfBirth}" />
									</rich:column>
									<rich:column>
										<h:outputText
											value="#{cv_data.personalInformation.nationality}" />
									</rich:column>
									<rich:column>
										<a4j:repeat value="#{cv_data.positions}" var="cap"
											id="repeat1">
											<h:outputText value="#{cap.role}" />
										</a4j:repeat>
									</rich:column>
									<rich:column>
										<c:forEach items="${cv_data.professionalExpiriance}" var="cap">
											<h:outputText value="#{cap.description}" />
										</c:forEach>
									</rich:column>
									<rich:column>
										<a4j:repeat value="#{cv_data.otherSkills}" var="cap"
											id="repeat2">
											<h:outputText value="#{cap.skill}" />
										</a4j:repeat>
									</rich:column>
									<rich:column>
										<a4j:repeat value="#{cv_data.languageSkills}" var="cap"
											id="repeat3">
											<cvis:outputCodelistValue cl="4" clValue="#{cap.language}"
												lang="en" />
										</a4j:repeat>
									</rich:column>
									<rich:column>
										<a4j:repeat value="#{cv_data.educationEntries}" var="cap"
											id="repeat4">
											<cvis:outputCodelistValue cl="5" clValue="#{cap.institution}"
												lang="en" />
										</a4j:repeat>
									</rich:column>
									<rich:column>
										<a4j:repeat value="#{cv_data.educationEntries}" var="cap"
											id="repeat5">
											<cvis:outputCodelistValue cl="6" clValue="#{cap.degree}"
												lang="en" />
										</a4j:repeat>
									</rich:column>
									<rich:column>
										<a4j:repeat value="#{cv_data.keyQualifications}" var="cap"
											id="repeat6">
											<h:outputText value="#{cap.qualification}" />
										</a4j:repeat>
									</rich:column>
									<f:facet name="footer">
									</f:facet>
								</rich:collapsibleSubTable>
							</rich:dataTable>
						</div>
						<rich:popupPanel id="saveSearchPop" modal="true" resizeable="true"
							domElementAttachment="parent">
							<f:facet name="header">
								<h:outputText value="Save Search....." />
							</f:facet>
							<f:facet name="controls">
								<h:outputLink value="#"
									onclick="#{rich:component('saveSearchPop')}.hide(); return false;">
		                Close
		            </h:outputLink>
							</f:facet>
							<h:panelGrid columns="2" id="saveSearchGrid">
								<h:outputText value="Name" />
								<h:inputText value="#{searchCV.criteria.name}" />

								<h:outputText value="Description " />
								<h:inputText value="#{searchCV.criteria.description}" />

								<h:outputText value="Start Date" />
								<rich:calendar id="startDate"
									value="#{searchCV.criteria.startDate}" navigator="true" />

								<h:outputText value="End Date" />
								<rich:calendar id="endDate"
									value="#{searchCV.criteria.endDate}" navigator="true" />

								<h:outputText value="Hours" />
								<rich:inputNumberSpinner minValue="0" maxValue="23"
									value="#{searchCV.criteria.hours}" />

								<h:outputText value="Minutes" />
								<rich:inputNumberSpinner minValue="0" maxValue="59"
									value="#{searchCV.criteria.minutes}" />
							</h:panelGrid>
							<h:message for="saveSearchGrid" />
							<a4j:commandButton value="Save" action="#{searchCV.saveSearch}"
								render="panel" execute="saveSearchPop"
								rendered="#{searchCV.emptySearch}"
								oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('saveSearchPop')}.hide();}" />
						</rich:popupPanel>
					</h:form>
				</rich:panel>
			</h:panelGrid>
			<br />
		</div>
	</ui:define>
</ui:composition>
</html>